<template>
  <div>修改store:$patch</div>
  <!-- <div>
    {{count}}
  </div>
  <div>
    {{doubleCount}}
  </div> -->
  <div>items:{{items}}</div>
  <div>hasChange:{{hasChange}}</div>
</template>
<script setup lang="ts">
import {useCounterStore} from '../../stores/counter'
import {storeToRefs} from 'pinia'
const counterStore = useCounterStore()
// 修改基本类型数据
// counterStore.$patch({
//   count:counterStore.count+1,
//   name:'admin'
// })

// 修改引用类型数据
counterStore.$patch((state) => {
  state.items.push({name:'shoes',quantity:100})
  state.hasChange = true
})
// const {count,doubleCount} = storeToRefs(counterStore)
const {items,hasChange} = storeToRefs(counterStore)
</script>